package tests;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class TestGet
{
    public static void main(String[] args)
    {
	ArrayList<Integer> arrayList = new ArrayList<Integer>();
	LinkedList<Integer> linkedList = new LinkedList<Integer>();

	long time = TestGet.Get(arrayList);
	System.out.println("ArrayList: " + time + "ms");

	time = TestGet.Get(linkedList);
	System.out.println("LinkedList: " + time + "ms");
    }

    private static long Get(List<Integer> list)
    {
	int size = 100000;

	for (int i = 0; i < size; i++)
	{
	    list.add(i);
	}

	long begin = System.currentTimeMillis();

	for (int i = 0; i < size; i++)
	{
	    list.get(i);
	}

	long end = System.currentTimeMillis();

	return end - begin;
    }
}
